import request from '@/utils/request';

interface ListParamsType {
    offset: number;
    limit: number
}
    
interface DetailParamsType {
    productId: number;
}

interface AddParamsType {
  companyId: number;
  typeId: number;
  productName: string;
  productDesc: string;
  productAge: string;
  productAmount: string;
  productAnnual: string;
  file: File;
}

export async function queryProduct(params: ListParamsType): Promise<any> {
  return request('/api/product', { params });
}

export async function queryProductDetail(params: DetailParamsType): Promise<any> {
  return request('/api/product/detail', { params });
}

export async function addProduct(params: AddParamsType): Promise<any> {
  return request.post('/api/product', { data: params });
}

export async function delProduct(params: DetailParamsType): Promise<any> {
  return request.delete('/api/product', { params });
}